
exports.__esModule = true;
exports.default = void 0;

const _utils = require('../utils');

const _checkbox = require('../mixins/checkbox');

const _createNamespace = (0, _utils.createNamespace)('radio');
const createComponent = _createNamespace[0];
const bem = _createNamespace[1];

const _default = createComponent({
  mixins: [(0, _checkbox.CheckboxMixin)({
    bem,
    role: 'radio',
    parent: 'vanRadio',
  })],
  computed: {
    currentValue: {
      get: function get() {
        return this.parent ? this.parent.value : this.value;
      },
      set: function set(val) {
        (this.parent || this).$emit('input', val);
      },
    },
    checked: function checked() {
      return this.currentValue === this.name;
    },
  },
  methods: {
    toggle: function toggle() {
      this.currentValue = this.name;
    },
  },
});

exports.default = _default;
